import React from 'react'

import {get} from '../../../fetch/get.js'
import DetailInfo from '../../../components/DetailInfo'

// import './style.scss'

class Info extends React.Component{
    constructor(props, context){
        super(props, context)
        this.state = {
            info: false
        }
    }
    render() {
        return (
            <div>
                {
                    this.state.info
                    ? <DetailInfo data={this.state.info}></DetailInfo>
                    : ''
                }
            </div>
        )
    }
    componentDidMount() {
        const result = get('/api/detail/info/' + this.props.id)
        result.then(res => {
            return res.json()
        }).then(json => {
            this.setState({
                info: json
            })
        })
    }
}

export default Info